home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #324 (1994-04)(Rhein-Sieg-Soft).zip
/
Franz PD Disk #324 (1994-04)(Rhein-Sieg-Soft).adf
/
VideoText3.5
/
source
/
decode.p
< prev
next >
Wrap
Text File
|
1994-04-01
|
6KB
|
175 lines
UNIT decode; {$project vt}
{ Zeichensatzkonvertierung zum Programm VideoText }
INTERFACE; FROM vt USES global;
PROCEDURE makeascii(source: p_onepage; zeile: integer; farblos: boolean;
var asciicode: str80);
PROCEDURE decode_line(source: p_onepage; zeile: integer; verdeckt: boolean;
VAR amigacode: bigstring; VAR dblheight: Boolean);
VAR blank40: String[41];
{ ---------------------------------------------------------------------- }
IMPLEMENTATION;
{$opt q,s+,i+}
VAR notascii: Array[32..127] OF Byte; STATIC;
vt_to_ascii, vt_to_myfont: Array[0..7] OF String[15]; STATIC;
j: Integer;
PROCEDURE makeascii{(source: p_onepage; zeile: integer; farblos: boolean;
var asciicode: str80)};
{ Eine Zeile einer VT-Seite für Drucker- oder Dateiausgabe umwandeln. }
{ Für <farblos>=false werden Farbcodes nicht einfach weggeworfen, sondern }
{ durch Klartext '\0' .. '\7' umschrieben. }
var thisbyte: byte;
start, spalte, i: integer;
grafik: boolean;
group8,group32,country: byte;
begin
if source=Nil then
asciicode := blank40
else begin
country := (source^.cbits SHR 12) AND $07;
start := zeile*40;
grafik := false;
i := 1;
for spalte := 0 to 39 do begin
thisbyte := source^.chars[start+spalte];
group8 := thisbyte SHR 3; { 8er-Gruppe }
group32 := group8 SHR 2; { 32er-Gruppe }
if group8=0 then grafik := false;
if group8=2 then grafik := true;
IF (group32=2) OR (NOT grafik AND (group32 in [1..3])) THEN
{ druckbares Zeichen, über Tabellen decodieren }
IF notascii[thisbyte]>0 THEN
asciicode[i] := vt_to_ascii[country][notascii[thisbyte]]
ELSE
asciicode[i] := chr(thisbyte)
ELSE
asciicode[i] := ' ';
if NOT farblos AND (group8=0) then begin { Farbcode als Klartext }
asciicode[i] := '\'; Inc(i); asciicode[i] := chr(thisbyte+ord('0'));
end;
Inc(i);
end;
asciicode[i] := chr(0);
end;
end;
{$opt i-}
PROCEDURE decode_line{(source: p_onepage; zeile: integer; verdeckt: boolean;
VAR amigacode: bigstring; VAR dblheight: Boolean)};
{ Setzt eine Zeile Teletextzeichen (40 Zeichen) in eine String für den }
{ Amiga um (bis zu 160 Zeichen, leider), mit ANSI-Steuerzeichen, für meinen }
{ teletext.font. }
{ Stringfunktionen absichtlich vermieden, soll vor allem schnell sein! }
var farbe, country, thisbyte, lastout, group32: byte;
grafik, hold, geheim: boolean;
start,spalte,i: integer;
begin
country := (source^.cbits SHR 12) AND $07;
farbe := 7;
grafik := False;
hold := False;
geheim := False;
dblheight := False;
i := 1;
start := zeile*40;
for spalte := 0 to 39 do begin
thisbyte := source^.chars[start+spalte] AND $7F;
if thisbyte<32 then begin { Steuerzeichen }
geheim := false;
if thisbyte=30 then hold := true;
if thisbyte=31 then hold := false;
if hold then begin
amigacode[i] := chr(lastout); inc(i);
end;
case thisbyte of
0..7: begin { neue Textfarbe }
grafik := false;
farbe := thisbyte;
amigacode[i] := #155; inc(i);
amigacode[i] := '3'; inc(i);
amigacode[i] := chr(farbe+48); inc(i);
amigacode[i] := 'm'; inc(i);
end;
{8: begin { Blinken (d. h. revers) ein }
amigacode[i] := #155; inc(i);
amigacode[i] := '7'; inc(i);
amigacode[i] := 'm'; inc(i);
end;}
{9: begin { Blinken aus }
amigacode[i] := #155; inc(i);
amigacode[i] := '0'; inc(i);
amigacode[i] := 'm'; inc(i);
end;}
13: dblheight := True; { doppelthohe Zeichen }
16..23: begin { neue Grafikfarbe }
grafik := true;
farbe := thisbyte-16;
amigacode[i] := #155; inc(i);
amigacode[i] := '3'; inc(i);
amigacode[i] := chr(farbe+48); inc(i);
amigacode[i] := 'm'; inc(i);
end;
24: geheim := true;
28: begin { Hintergrund schwarz }
amigacode[i] := #155; inc(i);
amigacode[i] := '4'; inc(i);
amigacode[i] := '0'; inc(i);
amigacode[i] := 'm'; inc(i);
end;
29: begin { Zeichenfarbe als Hintergrund }
amigacode[i] := #155; inc(i);
amigacode[i] := '4'; inc(i);
amigacode[i] := chr(farbe+48); inc(i);
amigacode[i] := 'm'; inc(i);
end;
otherwise;
end;
if not hold then begin
amigacode[i] := ' '; inc(i);
end;
end else begin { druckbares Zeichen }
IF grafik AND NOT (thisbyte IN [64..95]) THEN
thisbyte := thisbyte + 128
ELSE IF notascii[thisbyte]>0 THEN
thisbyte := ord(vt_to_myfont[country][notascii[thisbyte]]);
if (geheim and verdeckt) then
amigacode[i] := ' '
else
amigacode[i] := chr(thisbyte); inc(i);
lastout := thisbyte;
end;
end;
amigacode[i] := chr(0);
end;
{$opt i+}
BEGIN { Initialisierungsteil }
{ VT-Zeichensatzdekodierung }
{ Welche (druckbaren) Zeichen müssen überhaupt dekodiert werden? }
FOR j := 32 TO 127 DO notascii[j] := 0;
FOR j := 0 TO 1 DO notascii[35+j] := 1+j;
notascii[64] := 3;
FOR j := 0 TO 5 DO notascii[91+j] := 4+j;
FOR j := 0 TO 3 DO notascii[123+j] := 10+j;
{ Durch welche Zeichen werden sie ersetzt, a) im Standard-Amiga-Zeichensatz, }
{ b) in meinem videotext.font? }
{ Die Ländernummern (aus den Steuerbits als C12 + 2*C13 + 4*C14 berechnet) }
{ sind: 0=England, 1=Frankreich, 2=Schweden, 3=reserviert, 4=Deutschland, }
{ 5=Spanien, 6=Italien, 7=reserviert. }
vt_to_ascii[0] := '£$@«½»^#¼|¾÷'; vt_to_myfont[0] := 'Á$ÀÂÈÄÃ#-ÇÅÉÆ'; { GB }
vt_to_ascii[1] := 'éïàëêùî#èâôûç'; vt_to_myfont[1] := 'Ô×ÎÔÕÝØ#ÓÐÜßÒ'; { F }
vt_to_ascii[2] := '#¤ÉÄÖÅÜ_éäöåü'; vt_to_myfont[2] := '#ÌE[\Í]_Ô{|Ñ}'; { S }
vt_to_ascii[3] := '£$@«½»^#¼|¾÷'; vt_to_myfont[3] := 'Á$ÀÂÈÄÃ#-ÇÅÉÆ'; { ?? }
vt_to_ascii[4] := '#$§ÄÖÜ^_°äöüß'; vt_to_myfont[4] := '#$@[\]^_`{|}~'; { D }
vt_to_ascii[5] := 'ç$¡áéíóú¿üñèà'; vt_to_myfont[5] := 'Ò$ÊÏÔ×ÛÞË}ÙÓÎ'; { E }
vt_to_ascii[6] := '£$é°ç»^#ùàòèì'; vt_to_myfont[6] := 'Á$Ô`ÒÄÃ#ÝÎÚÓÖ'; { I }
vt_to_ascii[7] := '£$@«½»^#¼|¾÷'; vt_to_myfont[7] := 'Á$ÀÂÈÄÃ#-ÇÅÉÆ'; { ?? }
FOR j := 1 TO 40 DO blank40[j] := ' ';
blank40[41] := #0;
END.